package com.springapi.entity;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.Optional;

public enum KuaiDiStatus {
    SALE(1,"揽收"),
    OFF_SALE(0,"在途"),
    DELETE(3,"签收");

    @Getter@Setter
    private Integer code;
    @Getter@Setter
    private String desc;

    KuaiDiStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static KuaiDiStatus findByCode(Integer code){
        Optional<KuaiDiStatus> first = Arrays.stream(KuaiDiStatus.values()).filter(item->item.getCode().equals(code)).findFirst();
        return first.orElse(null);
    }
}
